'''
while 循环
while 条件判断:
    循环体

break 退出当前的循环
continue 退出本次循环，继续下一次的循环
'''

# 1--100
sum = 0
for i in range(1,101):
    sum += i

# 定义一个计数器
n = 1
sum1 = 0
while n <= 100:
    sum1 += n
    # 计数器+1
    n += 1

print(sum1)

# 不断输入数字，直到输入一个正确的数字7
# num = input("输入数字：")
#
# while num != "7":
#     print("继续输入")
#     # 继续输入
#     num =  input("输入数字：")

while True:
    num = input("输入数字：")
    if num == "7":
        # 当满足某个条件时，退出循环
        break

    print("继续输入数字")

# continue
# 求1-30之内的，所有的8的倍数和
sum = 0
for x in range(1,31):
    if x%8 == 0:
        sum += x

print(sum)

sum1 = 0
for y in range(1,31):
    # 如果不为8的倍数，进入下一次循环
    if y%8 != 0:
        continue

    # 加法求和
    sum1+=y
print(sum1)


